<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/5/26
 * Time: 17:30
 */

namespace App\Http\Middleware;

use Closure;
use Illuminate\Support\Facades\Redis;


class Adminmiddleware
{
    public function handle($request, Closure $next, $guard = null)
    {
        $id = Redis::get($request->input('admintoken'));
        if (!$id) {
            return ['code' => 401, 'msg' => 'Unauthorized'];
//            return response('Unauthorized.', 401);
        }
        return $next($request);
    }
}